package test;

import java.util.Arrays;

public class exercise_3 {

	public static void main(String[] args) {
		int[] numbers = { 7, 4, 2, 2, 5, 8, 7, 8, 10 };
		int count = 0;
		for (int i = 0; i < numbers.length - 1; i++) {
			for (int j = i + 1; j < numbers.length; j++) {
				if (numbers[i] == numbers[j]) {
					numbers[j] = 0;
					count++;
				}
			}

		}
		System.out.println(count);
		int[] newArr = new int[numbers.length - count];
		int j = 0;
		for (int i : numbers) {

			if (i != 0) {
				newArr[j++] = i;
			}

		}
		System.out.println(Arrays.toString(newArr));
	}

}
